home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_12_05 / plauger / copyfmt.c < prev    next >
C/C++ Source or Header  |  1994-03-08  |  852b  |  30 lines

  1.  
  2. --------------- Listing 5: The function ios;:copyfmt(ios&) --------------
  3.  
  4. // ioscopyfmt -- ios::copyfmt(const ios&)
  5. #include <ios>
  6.  
  7. ios& ios::copyfmt(const ios& rhs)
  8.     {    // copy format info from another ios
  9.     if (this != &rhs)
  10.         {    // copy all but _Sb and _State
  11.         _Tidy();
  12.         _Tiestr = rhs._Tiestr;
  13.         _Fmtfl = rhs._Fmtfl;
  14.         _Prec = rhs._Prec;
  15.         _Wide = rhs._Wide;
  16.         _Fillch = rhs._Fillch;
  17.         _Iosarray *p = rhs._Arr;
  18.         for (_Arr = 0; p != 0; p = p->_Next)
  19.             if (p->_Lo != 0 || p->_Vp != 0)
  20.                 {    // copy over nonzero array values
  21.                 iword(p->_Index) = p->_Lo;
  22.                 pword(p->_Index) = p->_Vp;
  23.                 }
  24.         exceptions(rhs._Except);    // cause any throw at end
  25.         }
  26.     return (*this);
  27.     }
  28.  
  29.  
  30.